public class Key {

    static int[] FK = SM4change.FK;
    static int[] CK = SM4change.CK;

    //32轮的密钥
    public static int[] keyGenerator(int[] init) {
        int[] tmpk = new int[]{init[0]^FK[0], init[1]^FK[1], init[2]^FK[2], init[3]^FK[3]};
        int[] key = new int[32];
        for(int i = 0; i < 32; i++) {
            int ki = tmpk[0]^SM4change.ReTchange(tmpk[1]^tmpk[2]^tmpk[3]^CK[i]);
            key[i] = ki;
            for(int j = 0; j < 3; j++)
                tmpk[j] = tmpk[j+1];
            tmpk[3] = ki;
        }
        return key;
    }
}